//封装axios的post请求
export function fetch(urL, params,method)
    {if ( !method) {
        method = 'post'
    }
    return new Promise((resoLve, reject) =>{
    //为了兼容生产环境和开发环境请求地址加入‘process.env .APT_HOST’
    axios({
    method: method,
    url: process.env .API_HOST + url,
    data: params
    })
    .then(response => {
    switch (response.data.status) {
    case 403:
    router.replace({
    path: '/login'
    })
}
    //请求错误
    resolve(response.data);
    })
    .catch((error) =>{
        reject(error);
        })
    })
    }
    